package com.jk.dmconsumer;

import com.jk.dmcommon.entity.CouponEntity;
import com.jk.dmcommon.entity.YeWuEntity;
import com.jk.dmconsumer.service.TreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.List;

//@SpringBootApplication(exclude = MongoAutoConfiguration.class)
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
@EnableEurekaClient
@EnableFeignClients
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = 18000)
@Controller
public class DmConsumerApplication {
    @Autowired
    private TreeService treeService;

    public static void main(String[] args) {
        SpringApplication.run(DmConsumerApplication.class, args);
    }

    @RequestMapping("show")
    public String show(String url) {
        return url;
    }
    @Bean
    public CookieSerializer cookieSerializer() {
        DefaultCookieSerializer cookieSerializer = new DefaultCookieSerializer();
        cookieSerializer.setSameSite(null);
        return cookieSerializer;
    }

    @RequestMapping("zyx")
    public String zyx() {
        return "index";
    }
    @RequestMapping("lwl")
    public String lwl(Model model,Integer goodsId) {
        model.addAttribute("goodsId",goodsId);
        return "show2";
    }
    @RequestMapping("buy")
    public String buy() {
        return "Address";
    }
    @RequestMapping("per")
    public String per() {
        return "personal";
    }
    /**
     * @description: 跳register页面
     * @param: [map]
     * @return: org.springframework.web.servlet.ModelAndView
     * @author 刘杨彬
     * @date: 2021/9/7 17:28
     */
    @RequestMapping("/register")
    public ModelAndView register(HashMap<String, Object> map) {
        ModelAndView mv =  new ModelAndView("passport.damai.cn/register");
        return mv;
    }
    @RequestMapping("/login")
    public ModelAndView login(HashMap<String, Object> map) {
        ModelAndView mv =  new ModelAndView("passport.damai.cn/login");
        return mv;
    }

    //支付页面
    @RequestMapping("paymentOrder")
    public String paymentOrder(){
        return "paymentOrder";
    }


    @RequestMapping("payShow")
    public String payShow(){
        return "payShow";
    }





    @RequestMapping("/search")
    public ModelAndView search(HashMap<String, Object> map) {
        System.out.println("*********************");
        ModelAndView mv =  new ModelAndView("zhanshiqiantai/search.damai.cn/ceshi");
        return mv;
    }
//    @RequestMapping("/search")
//    @ResponseBody
//    public String search2() {
//        System.out.println("少时诵诗书所所所所所所所所所");
//        return "zhanshipage/search.damai.cn/search";
//    }
        @RequestMapping("/home")
        public String index(){
            return "home";
        }
    //订座页面
        @RequestMapping("goupiao")
        public ModelAndView goupiao(HashMap<String, Object> map) {
            ModelAndView mv =  new ModelAndView("zhanshiqiantai/search.damai.cn/xuanzuo");
            return mv;
        }
    //王乐 个人中心 订单管理
    @RequestMapping("/orderList")
    public String orderList(){
        return "orderList";
    }


    @RequestMapping("myselfInfo")
    public String myself(){
        return "myselfInfo";
    }
    /*优惠劵页面*/
    @RequestMapping("couponList")
    public String couponList(){

        return "couponList";
    }

    @RequestMapping("/lgf2")
    public String lgf(){
        return "lgf";
    }

    @RequestMapping("/orderDetail")
    public String order(String id,Model model){
        model.addAttribute("id",id);
        return "order";
    }
    //测试会话
    @RequestMapping("/testme")
    public String testme(){
        return "test";
    }
    //测试座位
    @RequestMapping("/wlSitePage")
    public String wlSitePage(){
        return "wlSitePage";
    }
    //wl座位页面
    @RequestMapping("/sitePageWl")
    public String sitePageWl(){
        return "sitePageWl";
    }



















}
